<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <a href="addView.jsp">添加商品</a>
    <br/>
    <table border="1" cellpadding="0" cellspacing="0" width="50%">
        <tr>
            <th>商品编号</th>
            <th>商品名称</th>
            <th>商品价格</th>
            <th>商品产地</th>
            <th>操作</th>
        </tr>
		
		<c:forEach items="${productList}" var="pro">
        <tr>
            <td>${pro.id}</td>
            <td>${pro.name}</td>
            <td>${pro.price}</td>
            <td>${pro.address}</td>
            <td>
                <a href="javascript:delPro(${pro.id})">删除</a>
            </td>
        </tr>
		</c:forEach>
		<script>
                function delPro(id) {
                    if (confirm("确定要删除吗?")) {
                        location.href = "${pageContext.request.contextPath}/delete?id=" +id;
                    }
                }
            </script>
    </table>
</body>
</html>
